<?php
	class Index {
		function index(){

			
			$article=D("article");
			$column=D("column");
			$time=strtotime(date("Y-m-d"))+60*60*24;
			//获取并分配推荐文章
			$this->assign("recommends", $article->field('id,title,recommend')->where(array("recommend >"=>0, "audit"=>1))->order("recommend desc")->limit(10)->select());
			//获取并分配最新更新文章
			$data = $article->field('id,title,summary,posttime,views,picid')->where(array("audit"=>1))->order("posttime desc")->limit(6)
				            ->r_select( array("image", 'name as imgname', 'id', 'picid'));
			$this->assign("news", $data);
			//获取并分配热门文章
			$this->assign("hots", $article->field('id,title,posttime,views,picid')->where(array("posttime >"=>($time-60*60*24*30), "audit"=>1))->order("views desc")->limit(10)
				 ->r_select( array("image", 'name as imgname', 'id', 'picid')));
	
			//获取并分配所有栏目 
			$col=$column->field("id,title,picid")->order("ord asc")->where(array("pid"=>0,"display"=>1))
				        ->select();

			$this->assign("cols", $col);

			//p($data);
			//获取并分配友情链接内容
			$this->assign("links", D("flink")->field('id, webname,url')
				 ->where(array("audit"=>1))->order("ord asc")->select());
			$this->display();
		}



	}